# coding: utf-8
import gzip,bz2


def a():
    with gzip.open('somefile.gz', 'w') as f:
        text = 'zhangsan'
        f.write(str(text))
    with open('somefile.gz','r') as f:
        text = f.read()
        print(str(text))

if __name__ == '__main__':
    a()